﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using Downloader.Domain.Contracts.Tasks;
using Downloader.Domain.QueryParams;
using Downloader.Web.Controllers.Queries;
using SharpArch.NHibernate.Web.Mvc;

namespace Downloader.Web.Controllers.Admin
{
   public class UserAccountController : Controller
    {
       public IUserAccountQuery UserAccountQuery { get; set; }
       public IUserAccountTasks UserAccountTasks { get; set; }

       public ActionResult Index()
       {
           return View();
       }
       public ActionResult List(UserAccountQueryParams query)
       {
           var result = UserAccountQuery.GetList(query);
           return PartialView(result);
       }

       [Transaction]
       public ActionResult Dele(int id)
       {
           try
           {
               UserAccountTasks.Delete(id);
               return Json(new { success = true });
           }
           catch (Exception e)
           {
               return Json(new { success = false, data = e.Message });
           }
       }
    }
}
